package com.itheima.TCP.TCP接收协议;

import java.io.IOException;
import java.io.InputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.net.Socket;

public class ServerDemo1 {
    public static void main(String[] args) throws IOException {
        //创建socket对象

       ServerSocket ss = new ServerSocket(10000);

        while (true) {
            //等待客户端连接

          Socket so = ss.accept();
            //获得输入流对象
            InputStream is = so.getInputStream();


            int b;      //b表示的是每次读取到的字节数据
            while ((b=is.read())!=-1){
                System.out.println((char)b);
            }

            System.out.println();
        }

        //释放资源

    }
}
